home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Icon 8.1 / mep1 / External Functions / XCMDs⁄XFCNs / C Sources / GetGlobal.c next >
Encoding:
C/C++ Source or Header  |  1990-09-08  |  945 b   |  43 lines  |  [TEXT/KAHL]

  1. /*
  2.  * GetGlobal -- XFCN to transfer a HyperCard interface global to ProIcon
  3.  */
  4.  
  5. #include "IconXCmd.h"
  6.  
  7. pascal void main(paramPtr)
  8. XCmdBlockPtr    paramPtr;
  9.     {
  10.     Handle h;
  11.  
  12. /* check parameter */
  13.  
  14.     if (paramPtr->paramCount != 1) {
  15.         paramPtr->returnValue = (Handle)NewString("\pNeed one parameter in GetGlobal XFCN");
  16.         PtoCstr(*(paramPtr->returnValue));
  17.         return;
  18.         }
  19.  
  20.     /* Lock parameter, convert to a Pascal string */
  21.     h = paramPtr->params[0];
  22.     HLock(h);
  23.     CtoPstr(*h);
  24.  
  25.     /* Do lookup */
  26.     paramPtr->inArgs[0] = (long)*h;
  27.     paramPtr->request = xreqGetGlobal;
  28.     ((procPtr)(paramPtr->entryPoint))();
  29.     
  30.     /* Unlock global name */
  31.     HUnlock(h);
  32.     
  33.     /* Return result.  Check for error. */
  34.     if (paramPtr->result != xresSucc) {
  35.         paramPtr->returnValue = (Handle)NewString("\pUnsufficient memory in SetGlobal XFCN");
  36.         PtoCstr(*(paramPtr->returnValue));
  37.         }
  38.     else
  39.         paramPtr->returnValue = (Handle)paramPtr->outArgs[0];    /* All OK, return value */
  40.     }
  41.         
  42.  
  43.